﻿#ifndef NETCOMM_H
#define NETCOMM_H

#include <QObject>
#include <QTimer>
#include "Ice/Ice.h"
#include <IceStorm/IceStorm.h>
#include "./platform/RobotDef.h"

class netComm : public QObject
{
    Q_OBJECT
public:
    explicit netComm(QObject *parent = 0);
    virtual ~netComm();

    void InitRobotCoreComm();
    void ConnectRobotCoreComm();
    void ClearRobotCoreComm();
    void InitEngine();
    void StopTTS();
    void SendBehaviour(QString tts, QString speaker, int nSpeed,int nPicth, QString backmusic);
    bool IsEndTTs();//tts/audio
    //
    QTimer m_timerautoAction;
private:
    QString m_szLog;
    QTimer m_timer;
    void *m_parent;
    //platform
//    Robot::ScreenExPrx      m_screen;
    Robot::AudioPrx         m_audio;
    Robot::MotorPrx         m_motor;
    Robot::ScriptPrx        m_script;
    Robot::PubPrx           m_pub;
    Robot::ConfigPrx        m_config;
    Robot::JsonPrx          m_json;
    Ice::ObjectPrx          m_sub;
    IceStorm::TopicManagerPrx   m_topicManager;
    Ice::CommunicatorPtr    ice;
signals:

public slots:
};

/**********************************************************************************
 *********************************************************************************
 *******************************接收平台的类***************************************
 *********************************************************************************
 *********************************************************************************
 *********************************************************************************
 *********************************************************************************/
class PubCenter : public QObject, virtual public Robot::Pub
{
    Q_OBJECT
public:
    explicit PubCenter(QObject *parent = 0, void *pFrm = 0);
    virtual void Notify(const std::string &msgtype, const std::string &msg, const Ice::Current &);
    bool NotifyCloud(const std::string &, const Ice::Current &);
    void NotifyContral(bool, const Ice::Current &);
    // Pub interface
public:
    void NotifyTitleCloud(const std::string &, const std::string &, const Ice::Current &);
};

#endif // NETCOMM_H
